﻿using System.ComponentModel;

namespace AppEszköz.Config
{
    public class ConfigRegistryComponent : Component
    {
        private Container components;

        public ConfigRegistryComponent(IContainer container)
        {
            container.Add((IComponent)this);
            this.InitializeComponent();
        }

        public ConfigRegistryComponent()
        {
            this.InitializeComponent();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
                this.components?.Dispose();
            base.Dispose(disposing);
        }

        public string GetConfig(string applicationName, string settingsCategory, string key)
        {
            return ConfigRegistryHelper.GetConfig(applicationName, settingsCategory, key);
        }

        private void InitializeComponent()
        {
            this.components = new Container();
        }
    }
}
